package com.hzhr.iot.cqgas.ds.controller;

import com.hzhr.iot.core.util.HzhrDateUtil;
import com.hzhr.iot.cqgas.ds.dao.device.custom.DeviceDao;
import com.hzhr.iot.cqgas.ds.dao.log.LogDao;
import com.hzhr.iot.cqgas.ds.dao.statis.custom.StatisDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@RestController
public class TableCopyController {
    @Autowired
    StatisDao statisDao;
    @Autowired
    DeviceDao deviceDao;
    @Autowired
    LogDao logDao;

    @RequestMapping(value = "/device2statis/collectDevice")
    public void device2statis_collectDevice() throws Exception {
        statisDao.insert1();
    }

    @RequestMapping(value = "/user2device/company")
    public void user2device_company() throws Exception {
        deviceDao.insert1();
    }

    @RequestMapping(value = "/log2log/log")
    public void log2log_log() throws Exception {
        String dateStr = HzhrDateUtil.dateToStr(HzhrDateUtil.addDay(new Date(), 1), "yyyyMMdd");
        logDao.insert1(dateStr);
    }
}
